/**
 * $Id: SGIPUnbindMessage.java,v 1.1 2006/09/07 02:08:40 martin Exp $
 *
 * Copyright 2005 Skyinfo, Inc. All Rights Reserved.
 */
package com.haoxi.gateway.sgip12msg;

import com.haoxi.gateway.util.TypeConvert;

public class SGIPUnbindMessage extends SGIPMessage {

    public SGIPUnbindMessage() {
        int len = 20;
        buf = new byte[len];
        TypeConvert.int2byte(len, buf, 0);
        TypeConvert.int2byte(SGIPCommon.SGIP_UNBIND, buf, 4);
    }

    public SGIPUnbindMessage(byte buf[]) throws IllegalArgumentException {
        super.buf = new byte[12];
        if (buf.length != 12) {
            throw new IllegalArgumentException(
                    "The message that is sent by SMC is wrong");
        } else {
            System.arraycopy(buf, 0, super.buf, 0, 12);
            decodeSeq();
        }
    }

    public String toString() {

        String tmpStr = new StringBuffer("SGIP_UNBIND: ")
                .append("Src_node_Id=").append(getSrcNodeId())
                .append(",Time_Stamp=").append(getTimeStamp())
                .append(",Sequence_Id=").append(getSequenceId()).toString();
        return tmpStr;
    }

    public int getCommandId() {
        return SGIPCommon.SGIP_UNBIND;
    }
}
